Skip to content

Implement moveCursorToPageUp/Down and bind PageUp/PageDown to them - #124

Merged
MegatronKing merged 1 commit into
reqable:mainfrom
koldoon:feat/page-up-down
Aug 21, 2026
Merged

Implement moveCursorToPageUp/Down and bind PageUp/PageDown to them#124
MegatronKing merged 1 commit into
reqable:mainfrom
koldoon:feat/page-up-down

Conversation

@koldoon

@koldoon koldoon commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What this fixes

moveCursorToPageUp and moveCursorToPageDown are empty stubs marked
// TODO, and neither PageUp nor PageDown is bound to anything in the
default activators — on any platform. Pressing either key does nothing at all.

The change

  • Both methods are implemented. The page is measured from the viewport: as many
    lines as fit on screen, less one kept as an overlap so that the reader can
    connect what was on screen with what is there now.
  • When nothing is laid out yet there is no page to measure, so the cursor moves
    by a single line rather than standing still.
  • PageUp and PageDown are added to both default activator maps, next to the
    existing cursorMovePageStart / cursorMovePageEnd bindings.

Notes

With word wrap on, a wrapped line still counts as one, so the jump may be longer
than a screen. Moving by visual lines would need the target line to be laid out,
and it is not once it leaves the viewport — getDownPosition returns null there.
Happy to take a different approach if you prefer visual lines.

Found while building a file manager on re_editor.


Part of a small series from the same project: #122, #123, #125.

Both methods were empty stubs marked `// TODO`, and neither `PageUp` nor
`PageDown` was bound to anything in the default activators — on any platform.
Pressing either key did nothing at all.

The page is measured from the viewport: as many lines as fit on screen, less
one kept as an overlap so that the reader can connect what was on screen with
what is there now. When nothing is laid out yet there is no page to measure,
and the cursor moves by a single line instead of standing still.

With word wrap on a wrapped line still counts as one, so the jump may be
longer than a screen; moving by visual lines would need the target line to be
laid out, which it is not once it leaves the viewport.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants